package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.netca.gdltax.bpms.webservice.CertServiceClient;
import net.netca.gdltax.bpms.webservice.CertServicePortType;
import net.netca.testwebservice.bo.XMLConfig;

@SuppressWarnings("serial")
public class GetReqstatus extends HttpServlet {

	public GetReqstatus() {
		super();
	}

	public void destroy() {
		super.destroy();  
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String reqNum=request.getParameter("reqNum");
		
//		CertServiceClient client = new CertServiceClient("http://192.168.0.37:8082/businessmanage/services/CertService");
		CertServiceClient client = new CertServiceClient(XMLConfig.getInstance().getUrl());
		
		CertServicePortType service = client.getCertServiceHttpPort();
		int result=service.getRequestStatus(reqNum);
		
		System.out.println("状态码:"+result);
		
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out
				.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("<HTML>");
		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
		out.println("  <BODY>");
		
		out.println(result);
		out.println("  </BODY>");
		out.println("</HTML>");
		out.flush();
		out.close();
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request,response);
	}

	public void init() throws ServletException {
	}
}
